# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Math-Calculus-Bisection.t'

use Test::More tests => 3;
BEGIN { use_ok('Math::Calculus::Bisection') };

my ( $exp, $var ) = ( 'x^2 + x - 6', 'x' );
diag("\nExpression: " . $exp);

my $expected = 2;
diag("Expected: x=" . $expected);

my $bissec   = Math::Calculus::Bisection->new(
    expression => $exp,
    variable   => $var,
    start      => 1,
    end        => 3,
    precision  => 14
);
ok($bissec->validate, "initial validation");

my $got = $bissec->run;
diag("Got: x=" . $got);

cmp_ok( $got, '==', $expected, 'bissection run with expression: x^2 + x - 6' );

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

